﻿@using Microsoft.AspNetCore.Identity
@using MusicStore.Models

@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager

@if (SignInManager.IsSignedIn(User))
{
    <form asp-area="" asp-controller="Account" asp-action="LogOff" method="post" id="logoutForm" class="navbar-right">
        <ul class="nav navbar-nav navbar-right">
            <li>
                <a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
            </li>
            <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
        </ul>
    </form>
}
else if (User.Identity.IsAuthenticated)
{
    //This code block necessary only for NTLM authentication
    <ul class="nav navbar-nav navbar-right">
        <li>
            <p class="nav navbar-text navbar-right">Hello, @UserManager.GetUserName(User)!</p>
        </li>
    </ul>
}
else
{
    <ul class="nav navbar-nav navbar-right">
        <li><a id="registerLink" asp-controller="Account" asp-action="Register">Register</a></li>
        <li><a id="loginLink" asp-controller="Account" asp-action="Login">Log in</a></li>
    </ul>
}